A database is a collection of logically related data. A popular type of database is provided by the relational database management system (RDBMS), which stores data in tables (or relations) that are arranged as rows and columns. A conventional RDBMS typically provides predefined data types, such as integers, real numbers, character strings, and so forth, for storing different types of data.
As database technology has progressed, more sophisticated data types have been made available. One such data type is the user-defined data type (UDT). A UDT differs from the predefined data types mentioned above in that the UDT is not defined by the standard database query language of the database system, but rather is defined by a user, an application, a database management system, or by another standard (other than the standard database query language). A database system can implement both predefined data types (e.g., the number data type for representing numeric values, character string data types for representing a sequence of characters, and so forth) and UDTs.
Typically, a UDT is associated with one or more user-defined methods (UDMs). A method is basically a software routine, associated with a UDT, that is created by a user (or that is provided with database software) for performing specified tasks. Often, for a given UDT, a user may define a suite of UDMs. In addition to UDMs, a user may also define user-defined functions (UDFs). Whereas a UDM is associated with a UDT, a UDF is a software routine that can be associated with UDTs or predefined data types.
Typically, a relational database system provides a user with the ability to apply a set of relational operators (=, <, ≦, >, ≧, etc.) against a set of data types (integers, real numbers, character strings, etc.). Such relational operators are usually applied in predicates of database queries. An example database query is provided below:                SELECT*        FROM T1        WHERE x=5;        
The example query is a SELECT statement that is applied on table T1 with a predicate WHERE x=5. In conventional database systems, a predicate applied on predefined data types is represented as an operator-based parse tree. For example, the predicate expression, WHERE x=5, can be represented internally as an equals-operator parse tree, such as that shown in FIG. 1. The parse tree shown in FIG. 1 includes an equals-operator node, a left expression (that contains the field x), and a right expression containing the constant 5. By representing the predicate expression using the operator-based parse tree, the database software, which includes an optimizer, is able to categorize the predicate expression into one of several categories.
By categorizing different predicate expressions, an optimizer can efficiently determine if the use of performance-enhancing features (such as indexing and statistics) can improve the performance of a query plan. An optimizer is a module within the database software that is responsible for selecting a query plan (from among plural possible plans) for a given database query. In many cases, an optimizer uses a cost-based approach to selecting a query plan, in which the optimizer selects a plan that has the lowest cost (in terms of processing time and resource usage). As part of the query selection procedure, the optimizer checks to see if the use of performance-enhancing features, such as indexing and statistics, can help the performance of a query plan.
Because conventional relational database systems are a relatively mature technology, the classification of predicate expressions based on relational operators (such as <, =, >, etc.) is integrated into database software. Although conventional relational operators applied on predefined data types are typically represented by operator-based parse trees, such a representation is typically not available for user-defined “routines” (such as UDMs and UDFs). Therefore, for such user-defined routines, the optimizer is typically unable to apply performance-enhancement features such as indexing and statistics in the generation of a query plan. As a result, database system performance may suffer.